package com.ruoyi.yf.service.impl;

import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.yf.domain.Report;
import com.ruoyi.yf.domain.YfDistrictStatistical;
import com.ruoyi.yf.mapper.ReportMapper;
import com.ruoyi.yf.service.IReportservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("yfReportsService")
public class ReportServiceImpl implements IReportservice {

    @Autowired
    private ReportMapper reportMapper;
    @Autowired
    private SysDeptMapper deptMapper;
    /**
     * 统计报表
     *
     * @param disId
     * @param begindate
     * @param enddate
     * @return
     */
    @Override
    public List<Report> cityStatistical(Long disId, String begindate, String enddate) {
        return reportMapper.cityStatistical(disId,begindate,enddate);
    }

    /**
     * 查询医废统计列表
     *
     * @param disId
     * @param begindate
     * @param enddate
     * @return
     */
    @Override
    public List<Report> cityTrashTypeAll(Long disId, String begindate, String enddate) {
        return reportMapper.cityTrashTypeAll(disId,begindate,enddate);
    }

    /**
     * 医废类型统计
     *
     * @param disId
     * @param begindate
     * @param enddate
     * @return
     */
    @Override
    public List<Report> trashType(Long disId, String begindate, String enddate) {
        return reportMapper.trashType(disId, begindate, enddate);
    }

    /**
     * 条形统计图 存积量 预警值
     *
     * @param disId
     * @return
     */
    @Override
    public List<Report> storage_bar(String disId,int limit) {
        return reportMapper.storage_bar(disId,limit);
    }

    @Override
    public List<Report> dept_trash_sum_staging(Long deptId) {
        return reportMapper.dept_trash_sum_staging(deptId);
    }

    @Override
    public List<Report> trash_type_sum_staging(Long deptId) {
        return reportMapper.trash_type_sum_staging(deptId);
    }

    @Override
    public List<Report> now_day_dept_trash_sum_staging(Long deptId) {
        return reportMapper.now_day_dept_trash_sum_staging(deptId);

    }

    @Override
    public List<Report> now_day_trash_type_sum_staging(Long deptId) {
        return reportMapper.now_day_trash_type_sum_staging(deptId);

    }

    @Override
    public Report bagandweight(Long deptId) {
        return reportMapper.bagandweight(deptId);
    }

    @Override
    public List<Report> gathering_week_of_statistics(Long deptId) {
        return reportMapper.gathering_week_of_statistics(deptId);
    }

    @Override
    public Report brashTypeNowSumStatistical(Long deptId) {
        return reportMapper.brashTypeNowSumStatistical(deptId);
    }


    @Override
    public Report previewMain(Long deptId) {
        return reportMapper.previewMain(deptId);
    }

    /**
     * 报表 月感控表
     *
     * @return
     */
    @Override
    public List<Report> reportYGK(Report report) {
        return reportMapper.reportYGK(report);
    }

    /**
     * 报表 月明细表
     *
     * @param report
     * @return
     */
    @Override
    public List<Report> reportYMX(Report report) {
        return reportMapper.reportYMX(report);
    }

    /**
     * 报表 胎盘统计表
     *
     * @param report
     * @return
     */
    @Override
    public List<Report> reportTP(Report report) {
        return reportMapper.reportTP(report);
    }

    /**
     * 危险废物转移联单
     */
    @Override
    public List<Report> reportWXFWZY(Report report) {
        return reportMapper.reportWXFWZY(report);
    }

    /**
     * XiaoYi...
     * 卫生员接收医废
     *
     * @Date : 2020-03-11 10:56
     */
    @Override
    public List<Report> reportWSYJS(Report report) {
        return reportMapper.reportWSYJS(report);
    }

    /**
     * 自定义查询sql
     *
     * @param sql
     * @return
     */
    @Override
    public List<Report> report_select_sql(String sql) {
        return reportMapper.report_select_sql(sql);
    }


    /**
     * 积存量变化趋势图
     *
     * @param deptId
     * @return
     */
    @Override
    public List<Report> storage_axis(Long deptId) {
        return reportMapper.storage_axis(deptId);
    }


    /**
     * 获取今年医废总产量、总袋数
     *
     * @param deptId
     * @return
     */
    @Override
    public Report getYearYFTotalWeightAndBags(Long deptId) {
        return reportMapper.getYearYFTotalWeightAndBags(deptId);
    }


    /**
     * 条形统计图 医疗机构数量
     */
    @Override
    public List<Report> hospitalNumBarList(String disId, String hospitalTypeIds, int limit) {
        return reportMapper.hospitalNumBarList(disId, hospitalTypeIds, limit);
    }


    /**
     * 医院医废总产量统计排行
     */
    @Override
    public List<Report> hospitalYFStatisticsList(Long deptId) {
        return reportMapper.hospitalYFStatisticsList(deptId);
    }


    /**
     * 大屏 -- 医废种类饼状图
     */
    @Override
    public List<Report> trashTypeStatistics(Long deptId) {
        return reportMapper.trashTypeStatistics(deptId);
    }


    /**
     * 区县级卫健局 显示医院数量、暂存点数量
     */
    @Override
    public Report CountyHospitalNumBarList(String disId) {
        return reportMapper.CountyHospitalNumBarList(disId);
    }


    /**
     * 区县级卫健局 显示区县级卫健局下属医院、社区 -- 积存量、预警值
     */
    @Override
    public List<Report> countyStorageBar(String disId,int limit2) {
        return reportMapper.countyStorageBar(disId,limit2);
    }

    /**
     * 获取医院总量 及位置
     *
     * @param deptId
     * @return
     */
    @Override
    public List<Report> getHospitalWeightBagPoint(Long deptId) {
        return reportMapper.getHospitalWeightBagPoint(deptId);
    }


    /**
     * 区县级卫健局 -- 显示区县级卫健局下辖医院  -- 产生量、转运量、暂存量
     */
    @Override
    public List<Report> countyStatistical(Long disId, String begindate, String enddate) {
        return reportMapper.countyStatistical(disId,begindate,enddate);
    }


    /**
     * 区县级卫健局 -- 显示区县级卫健局下辖医院  -- 各医废类型
     */
    @Override
    public List<Report> countyTrashTypeAll(Long disId, String begindate, String enddate) {
        return reportMapper.countyTrashTypeAll(disId,begindate,enddate);
    }

    @Override
    public List<Report> selectTagUpdateDescLimit(Long deptId, int limit) {
        return reportMapper.selectTagUpdateDescLimit(deptId,limit);
    }


    // 定时查询某天的医废统计
    @Override
    public List<YfDistrictStatistical> getDistrictYFStatistical(Long districtId, String date) {
        return reportMapper.getDistrictYFStatistical(districtId,date);
    }


    // 历史积存量趋查询（近一周）
    @Override
    public List<Report> storageHistoryAxisListByLatestWeek(Long countyId,String flag, Long districtId) {
        return reportMapper.storageHistoryAxisListByLatestWeek(countyId,flag, districtId);
    }

    // 历史积存量趋查询（按月查询：yyyy-MM ）
    @Override
    public List<Report> storageHistoryAxisListByYearMonth(Long countyId,String flag, Long districtId, String startDay, String endDay) {
        return reportMapper.storageHistoryAxisListByYearMonth(countyId,flag, districtId, startDay , endDay);
    }

    // 历史积存量趋查询（按年查询：yyyy）
    @Override
    public List<Report> storageHistoryAxisListByYear(Long countyId,String flag, Long districtId, String startDay, String endDay) {
        return reportMapper.storageHistoryAxisListByYear(countyId,flag, districtId, startDay , endDay);
    }


    // 省市区县医废向下钻取 -- 按医疗机构统计医废
    @Override
    public List<Report> getStatisticalWithHospital(Long deptId, String startDate, String endDate) {
        return reportMapper.getStatisticalWithHospital(deptId, startDate, endDate);
    }

    // 省市区县医废向下钻取 -- 医疗机构下辖机构
    @Override
    public List<Report> getHospitalManagerHospital(Long deptId, String startDate, String endDate) {
        return reportMapper.getHospitalManagerHospital(deptId, startDate, endDate);
    }

    @Override
    public Report previewComponyMain(Long componyId) {
        //根据公司部门Id查出所管理的的医院部门id
        List<Long> hospitals = deptMapper.selectHospitalByComponyId(componyId);
        return reportMapper.previewComponyMain(hospitals);
    }


}
